/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('onlinevideos');

// Singleton class
var TinyMCE_onlinevideosPlugin = {
	getInfo : function() {
		return {
			longname : 'onlinevideos plugin',
			author : 'Liudas Šumskas',
			authorurl : '',
			infourl : '',
			version : '0.1'
		};
	},

	initInstance : function(inst) {
		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/onlinevideos/css/content.css");	
	},

	getControlHTML : function(cn) {
		switch (cn) {
			case "onlinevideos":
				return tinyMCE.getButtonHTML(cn, 'lang_onlinevideos_desc', '{$pluginurl}/images/onlinevideos.gif', 'mceInsertOnlineVideos', true);
		}
		return "";
	},

	execCommand : function(editor_id, element, command, user_interface, value) {		
		switch (command) {
			case "mceInsertOnlineVideos":
				if (user_interface) {
					var onlinevideo = new Array();
					onlinevideo['file'] = '../../plugins/onlinevideos/onlinevideos.html'; // Relative to theme
					onlinevideo['width'] = 500;
					onlinevideo['height'] = 300;
					tinyMCE.openWindow(onlinevideo, {editor_id: editor_id, resizable: "no", inline: "yes", scrollbars: "no"});
				}
				return true;
		}
	   return false;
	}
};
tinyMCE.addPlugin("onlinevideos", TinyMCE_onlinevideosPlugin );